<?php
declare(strict_types=1);

namespace App\Logic\User\Repository;

use App\Models\User\UserProfessionModel;
use Closure;

class UserProfessionRepository implements UserRepositoryInterface
{

    public function repositoryAll(Closure $closure, $searchFields): array
    {
        return UserProfessionModel::query()
            ->where($closure)
            ->where([
                ["is_show", "=", 1]
            ])
            ->orderByDesc("orders")
            ->get($searchFields)
            ->toArray();
    }

    public function repositorySelect(Closure $closure, int $perSize, array $searchFields = []): array
    {
        return [];
    }

    public function repositoryCreate(array $insertInfo): bool
    {
        return false;
    }

    public function repositoryFind(Closure $closure, array $searchFields = []): array
    {
        $bean = UserProfessionModel::query()->where($closure)->first($searchFields);
        return !empty($bean) ? $bean->toArray() : [];
    }

    public function repositoryUpdate(array $updateWhere, array $updateInfo): int
    {
        return 0;
    }

    public function repositoryWhereInDelete(array $deleteWhere, string $field): int
    {
        return 0;
    }

    public function repositoryDelete(array $deleteWhere): int
    {
        return 0;
    }
}
